using UnityEngine;
using UnityEngine.UI;
public class BallBucket : MonoBehaviour {
    public Text scoreText;
    public int score;

    private void Start () {
        this.score = 0;
    }

    private void Update () {
        this.scoreText.text = this.score.ToString ();
    }

    private void OnTriggerEnter2D(Collider2D other) {
        Debug.Log ("检测到了：" + other.gameObject.name);
        if (other.tag == "Ball") {
            if (other.GetComponent<Rigidbody2D> ().velocity.y < 0) {
                this.score++;
                other.GetComponent<Animator>().Play("Reset");
            }
        }        
    }
}